package jindong;

import java.util.Scanner;

public class Main1 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] qa, qb, pa, pb;
        int ans = 0;
        qa = new int[n];
        qb = new int[n];
        pa = new int[n];
        pb = new int[n];
        for (int i = 0; i < n; ++i) {
            qa[i] = scanner.nextInt();
        }
        for (int i = 0; i < n; ++i) {
            qb[i] = scanner.nextInt();
        }
        for (int i = 0; i < n; ++i) {
            pa[i] = scanner.nextInt();
        }
        for (int i = 0; i < n; ++i) {
            pb[i] = scanner.nextInt();
        }
        for (int i = 0; i < n; ++i) {
            if ((qa[i] < qb[i] && pa[i] > pb[i]) ||
                    (qa[i] > qb[i] && pa[i] < pb[i])) {
                ans++;
            }
        }
        System.out.println(ans);
    }
}
